package LeetCode.leetcode239;

class Solution {
    public int[] maxSlidingWindow(int[] nums, int k) {
        int size = nums.length - k + 1;
        int[] res = new int[size];
        for (int i = 0; i < size; i++) {
            int max = nums[i];
            for (int j = i; j < k; j++) {
                if (nums[j] > max) max = nums[j];
            }
            res[i] = max;
        }
        return res;
    }
}